from .base import *
from django.contrib import admin

# 开发环境配置文件
DEPLOY = 'DEV'

# 开发环境
DEBUG = True

DATABASES = {
    'default': {
        'ENGINE': "django.db.backends.mysql",
        "NAME": "fiery-eyes-prod",
        "USER": "quma",
        "PASSWORD": "0XKpgk8eM50amVaI",
        "HOST": "cdb-fk2kw8y7.gz.tencentcdb.com",
        "PORT": "10098",
        "OPTIONS": {
            "charset": "utf8mb4"
        }
    }
}

DJANGO_APPS = [
    'simpleui',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles'
]

THIRD_APPS = [
    'rest_framework'
]

# 自建APP放在这里
LOCAL_APPS = [
    'license',  # 授权
]

INSTALLED_APPS = DJANGO_APPS + THIRD_APPS + LOCAL_APPS

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware'
]

# 日志模块
LOGGING = {
    "version": 1,
    "disable_existing_loggers": True,  # 禁用已经存在的日志记录器, 保持唯一性
    'formatters': {
        "standard": {
            "format": "%(asctime)s [%(threadName)s:%(thread)d] [%(name)s:%(lineno)d] [%(module)s:%(funcName)s] [%(levelname)s] - %(message)s"
        }
    },
    "filters": {

    },
    "handlers": {
        'console': {
            'level': "DEBUG",
            "class": "logging.StreamHandler",  # 设定日志输出到标准控制台
            "formatter": "standard"
        }
    },
    # 设置日志记录器
    "loggers": {
        'django': {
            'handlers': ['console'],
            'level': 'INFO',
            'propagate': False,  # 设定该日志记录器不会将消息传递给父日志记录器(如果有的话)
        }
    }
}

#
# 进行全局的 Simple UI 配置
SIMPLEUI_DEFAULT_THEME = 'admin.lte.css'
SIMPLEUI_LOGIN_PARTICLES = False
admin.AdminSite.site_header = 'huoyan license server'
admin.AdminSite.site_title = 'huoyan license server'
admin.AdminSite.index_title = 'huoyan license server'

# XXTEA加密秘钥
XXTEA_ENCRYPT_KEY = "PAkovMU9VJ8gb4tR"

# cos相关
PRIMARY_DIR = "fieryeyes"
COS_DIR = "/data/fiery-eyes-file"

# cos bucket 一级目录
COS_BUCKET_FIRST_LEVER_DIRECTORY = "client-side"

# TODO 需要替换成项目的配置
QCLOUD_STORAGE_OPTION = {
    'SecretId': 'AKIDwu44sVjspcH3lIww2MemiZG1sfWHqDOL',
    'SecretKey': '73nKekgT3X5oXdYDDKKQWZVKySpPs8Ng',
    'Region': 'ap-guangzhou',
    'Bucket': 'ddjifen-1314083908',
    'BUCKET_URL': 'https://ddjifen-1314083908.cos.ap-guangzhou.myqcloud.com'
}

JWT_SECRET_KEY = "sn30p4PhTf7XwODmiI4b4Xt2tONuqLLS"

# 一些常量配置
CERT_VALID_DAY = 7 * 24 * 60 * 60  # 证书有效天数为7天，单位(秒)
CERT_PRE_DAY = 3 * 24 * 60 * 60  # 证书提前续期天数, 单位(秒)
